<?php
session_start();

// Turn off all error reporting - production environment
error_reporting(0);

// Report all PHP errors (see changelog) - development environment
//error_reporting(E_ALL);


include 'actions/'."db_connect.php";



$page = $_GET['page'];
    $front_include_path = "views/front/";

    if ($page == "") {
        $page_to_include = $front_include_path."recent_news.php";
        $side = $front_include_path."sidebar1.php";
    }
    else if($page == "latest_news") {
        $page_to_include = $front_include_path."latest_news.php";
        $side = $front_include_path."sidebar1.php";
    }
	else if($page == "single_news") {
        $page_to_include = $front_include_path."single_news.php";
        $side = $front_include_path."sidebar1.php";
    }
    else if($page == "archives") {
        $page_to_include  = $front_include_path."archives.php";
        $side = $front_include_path."sidebar1.php";
    }
    else if($page == "categories") {
        $page_to_include = $front_include_path."categories.php";
        $side = $front_include_path."sidebar1.php";
    }
    else if($page == "gallery") {
        $page_to_include = $front_include_path."gallery.php";
        $side = $front_include_path."sidebar2.php";
    }
    else if($page == "about") {
        $page_to_include = $front_include_path."about.php";
        $side = $front_include_path."sidebar2.php";
    }
    else if($page == "feedback") {
        $page_to_include = $front_include_path."feedback.php";
        $side = $front_include_path."sidebar2.php";
    }
    else if($page == "registration_form") {
        $page_to_include = $front_include_path."reg_form.php";
        $side = $front_include_path."sidebar2.php";
    }
    else if($page == "sign_in") {
        $page_to_include = $front_include_path."sign_in.php";
        $side = $front_include_path."sidebar2.php";
    }
    else if($page == "search_result") {
        $page_to_include = $front_include_path."search_result.php";
        $side = $front_include_path."sidebar2.php";
    }
?>

<html>
    <head>
        <title>NOC</title>
            <script type="text/javascript" src="js/jquery.js"> </script>

    <script type="text/javascript">
         function blankthis(a){
             if(a.value == a.defaultValue) a.value = "";

         }
         function unblankthis(a){
             if(a.value == "") a.value = a.defaultValue;
         }
   
$(document).ready(function(){

    $("#quick-search").submit(function(){
        var keyword = $("#keyword").val();
        var key_len = $("#keyword").val().length;
        if ( $("#keyword").val() == "Search..."){
             return false;
        }
         if (key_len > 3 ) {
            //do ajax
            $.ajax({
                 type: "POST",
                 url: "actions/search_result.php",
                 data: "keyword="+keyword,
                 success: function(response) {

                     $("#main").html("");
                     $("#main").html(response);
                     //alert(response);

                 }
            
        });
       return false;
      }
        else {
            alert("Please provide longer keyword!");
            return false;
        }
        
    });
});





</script>




        <link rel="stylesheet" type="text/css" media="screen" href="css/front/screen.css" />
        <!--[if IE 6]><link rel="stylesheet" type="text/css" href="css/front/ie6.css" media="screen" /><![endif]-->

    </head>

    <body>

        <!-- wrap -->
        <div id="wrap">

            <!-- header -->
            <div id="header">

                <a name="top"></a>

                <h1 id="logo-text"><a href="index.php" title="">News On Click</a></h1>
                <p id="slogan">Whenever..Wherever..News - Just A Click Away!!!</p>



                <?php include $front_include_path."nav.php";?>
<!-- show only if admin using ++ Cpanel-->
        <?php
        $flag = $_SESSION['is_loggedin'];
        if($flag == "yes")
           {?>
                <div id="sign_box" ><a href="admin.php">Admin Panel</a></div>
        <?php } ?>
<!-- cpanel end  -->

                <form id="quick-search" action="views/front/search_result.php" method="POST">
                    <p>
                        <label for="qsearch">Search:</label>
                        <input class="tbox" id="keyword" type="text" name="keyword" value="Search..." title="" onfocus="blankthis(this);" onblur="unblankthis(this);"/>
                        <input class="btn" alt="Search" type="image" name="submit" title="Search" src="images/search.png"/>
                    </p>
                </form>

                <!-- /header -->
            </div>
                <!-- featured -->
                    <?php  if ($page == "") include $front_include_path."featured.php"; ?>
                <!-- content -->
            <div id="content-wrap" class="clear">
                <div id="content">

                    <!-- main -->
                    <div id="main">
                        <?php include $page_to_include;?>

                        <!-- /main -->
                    </div>

                    <!-- sidebar -->
                    <div id="sidebar">
                        <?php include $side;  ?>

                    <!-- /sidebar -->
                    </div>

                    <!-- /content -->
                </div>
                <!-- /content-wrap -->
            </div>
            <!-- /wrap -->
        </div>

        <!-- footer -->
        <div id="footer">

            <!-- footer-outer -->
            <div id="footer-outer" class="clear"><div id="footer-wrap">

                    <div class="col-a">

                        <h3>Contact Info</h3>

                        <p>
                            <strong>Phone: </strong>+1234567<br/>
                            <strong>Fax: </strong>+123456789
                        </p>

                        <p><strong>Address: </strong>123 Put Your Address Here</p>

                        <p><strong>E-mail: </strong>me@jungleland.com</p>
                        <p>Want more info - <a href="index.php?page=about" title="Know about us">go to contact page</a></p>

                        <h3>Follow Us</h3>

                        <div class="footer-list">
                            <ul>
                                <li><a href="index.php" class="rssfeed">RSS Feed</a></li>
                                <li><a href="index.php" class="email">Email</a></li>
                                <li><a href="index.php" class="twitter">Twitter</a></li>
                            </ul>
                        </div>

                    </div>

                    <div class="col-a">

                        <h3>Site Links</h3>

                        <div class="footer-list">
                            <ul>
                                <li><a href="index.php">Home</a></li>
                                <li><a href="index.php">Latest News</a></li>
                                <li><a href="index.php">Archive</a></li>
                                <li><a href="index.php">Categories</a></li>
                                <li><a href="index.php">Gallery</a></li>
                                <li><a href="index.php">About</a></li>
                                <li><a href="index.php">Site Map</a></li>
                            </ul>
                        </div>

                    </div>

                    <div class="col-a">

                        <h3>Web Resource</h3>

                        <p>Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu
			posuere nunc justo tempus leo. </p>

                        <div class="footer-list">
                            <ul>
                                <li><a href="http://www.dreamtemplate.com" title="Website Templates">DreamTemplate</a></li>
                                <li><a href="http://www.themelayouts.com" title="WordPress Themes">ThemeLayouts</a></li>
                                <li><a href="http://www.imhosted.com" title="Website Hosting">ImHosted.com</a></li>
                                <li><a href="http://www.dreamstock.com" title="Stock Photos">DreamStock</a></li>
                                <li><a href="http://www.evrsoft.com" title="Website Builder">Evrsoft</a></li>
                                <li><a href="http://www.webhostingwp.com" title="Web Hosting">Web Hosting</a></li>
                            </ul>
                        </div>

                    </div>

                    <div class="col-b">

                        <h3>About</h3>

                        <p>
                            <a href="index.php"><img src="images/gravatar.jpg" width="40" height="40" alt="firefox" class="float-left" /></a>
			Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. 
			Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu 
			posuere nunc justo tempus leo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. 
			Cras id urna. <a href="index.php">Learn more...</a>
                        </p>

                    </div>

                    <div class="fix"></div>

                    <!-- footer-bottom -->
                    <div id="footer-bottom">

                        <div class="bottom-left">
                            <p>
                                &copy;&nbsp;<?php  echo date(Y); ?> <strong>Full rights reserved by NOC</strong>&nbsp; &nbsp; &nbsp;
                            </p>
                        </div>

                        <div class="bottom-right">
                            <p>

                                <a href="index.php">Home</a> |
                                <strong><a href="#top" class="back-to-top">Back to Top</a></strong>
                            </p>
                        </div>

                        <!-- /footer-bottom -->
                    </div>

                    <!-- /footer-outer -->
                </div></div>

            <!-- /footer -->
        </div>

    </body>
</html>
